﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text.RegularExpressions;

namespace ZYStudios.Helper
{
    public class Chinese2Number
    {
        /// <summary>
        /// 将字符串转成日期类型，如二○○七年十二月六日,转成2007-12-6
        /// </summary>
        /// <param name="strNumber"></param>
        /// <returns></returns>
        public DateTime ConvertTime(string strNumber)
        {
            //如果字符长度为空，则返回最小的日期值
            if (strNumber == null || strNumber == "")
            {
                return DateTime.MinValue;
            }
            try
            {
                return Convert.ToDateTime(strNumber);
            }
            catch
            {
            }
            strNumber = strNumber.Replace(".", "-");
            try
            {
                return Convert.ToDateTime(strNumber);
            }
            catch
            {
            }

            strNumber = strNumber.Replace("月", "-").Replace("日", "").Replace("号", "");
            try
            {
                return Convert.ToDateTime(strNumber);
            }
            catch
            {
            }

            return DateTime.MinValue;
        }
    
    }
}